package com.start.manager.controller;

import com.start.manager.domain.vo.UserVO;
import com.start.manager.domain.enums.ResultEnum;
import com.start.manager.service.IUserService;
import com.start.manager.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 主控制类
 *
 * @author jian.li
 * @date 2019年 12月19日 13:53:28
 */
@Controller
public class MainController {


    @Autowired
    private IUserService userService;

    @PostMapping(value = "/login",produces = MediaType.APPLICATION_JSON_VALUE,consumes = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public ResponseResult login(@RequestBody UserVO userVO){
        String token = userService.login(userVO);
        return ResponseResult.success(ResultEnum.SUCCESS,token);
    }
}
